import React, { useMemo } from "react";

import { Route, Routes, Navigate, useLocation, useNavigate } from "react-router-dom";

import { EyeOutline, AppOutline, TruckOutline, UserOutline } from "antd-mobile-icons";

// import { useUser } from './utils/index'

import "./App.scss";

import Home from "./views/Home/Home";
import Search from "./views/Home/Search";
import Detail from "./views/Detail";
import Rank from "./views/Rank/Rank";
import Bookbox from "./views/Bookbox/Bookbox";
import My from "./views/My/My";
import Login from "./views/My/Login";
import Reg from "./views/My/Reg";
import Shop from "./views/Shop/Shop";
import Data from "./views/My/Data";

function App() {
    const navigate = useNavigate();

    const changeTab = function (path) {
        navigate(path);
    };

    const { pathname } = useLocation();
    console.log("location", location);

    // const {userInfo} = useUser()
    // const isLogin = useMemo(() => !!userInfo.authorization, [userInfo])

    return (
        <div className="container">
            <main>
                <Routes>
                    <Route path="/home" element={<Home />} />
                    <Route path="/search" element={<Search />} />
                    <Route path="/detail" element={<Detail />} />
                    <Route path="/shop" element={<Shop />} />
                    <Route path="/goods/:detail" element={<Detail />} />

                    <Route path="/Rank" element={<Rank />} />
                    <Route path="/bookbox" element={<Bookbox />} />
                    <Route path="/my" element={<My />} />
                    <Route path="/login" element={<Login />} />
                    <Route path="/reg" element={<Reg />} />

                    <Route path="/" element={<Navigate to="/home" />} />
                    <Route path="/data" element={<Data />} />
                </Routes>
            </main>
        </div>
    );
}

export default App;
